package model
{
	public class TaskVO
	{
		public static var MAX_LEN_DESC:int = 255;
		
		public var id:int;
		private var _description:String;
		[Bindable]
		public var category:CategoryVO;
		[Bindable]
		public var project:ProjectVO;
		[Bindable]
		public var completed:Boolean;
		[Bindable]
		public var due_date:Date;
		
		public function TaskVO( description:String = null,
								project:ProjectVO = null,
								category:CategoryVO = null,
								completed:Boolean = false,
								due_date:Date = null,
								id:int = -1 )
		{
			this.description = description;
			this.project = project;
			this.category = category;
			this.completed = completed;
			this.due_date = due_date;
			this.id = id;	
		}

		// Seperate setter and getter to enforce max length
		[Bindable]
		public function set description( value:String ):void
		{
			_description = value.slice(0, MAX_LEN_DESC-1);
		}
		
		public function get description():String
		{
			return _description;
		}

		public function get label():String
		{
			return _description;
		}
		
	}
}